package com.bibrApp.difu.fragment.receiver_mvp;

import android.content.Context;
import android.util.Log;

import com.bibrApp.difu.api.RetrofitNet;
import com.bibrApp.difu.base.BasePresenter;
import com.bibrApp.difu.fragment.send_mvp.ISendView;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

public class ReceiverPresenter extends BasePresenter<IReceiverView> {

    public ReceiverPresenter(Context context, IReceiverView iView) {
        super(context, iView);
    }


    public void getBtcBlance(String type ,String publicKey) {
        RetrofitNet.getInstance().getApi(true)
                .getBtcBlance(type ,publicKey,"txs","used",String.valueOf(System.currentTimeMillis()))
                .compose(getActivityLifecycleProvider().bindToLifecycle())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io())
                .subscribe(o -> {
                    if (o != null) {
                        iView.successOfGetAssets(o);
                    }
                },throwable -> {
                    Log.d("dj",throwable.getMessage());
                });

    }
}
